<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>美丽说-订单确认</title>
    <link rel="stylesheet" href="/public/home/css/base.css" type="text/css" />
    <link rel="stylesheet" href="/public/home/css/shop_common.css" type="text/css" />
    <link rel="stylesheet" href="/public/home/css/shop_header.css" type="text/css" />
    <link rel="stylesheet" href="/public/home/css/shop_gouwuche.css" type="text/css" />
    <link rel="icon" href="/public/home/images/7d026282ff00a259b6a7b90eee6d_48_48.c5.png" type="image/x-icon"/>
    <script type="text/javascript" src="/public/home/js/jquery.js"></script>
    <script type="text/javascript" src="/public/home/js/topNav.js"></script>
    <style type="text/css">
    .shop_bd_shdz_title{width:1000px; margin-top: 10px; height:50px; line-height: 50px; overflow: hidden; background-color:#F8F8F8;}
    .shop_bd_shdz_title h3{width:120px; text-align: center; height:40px; line-height: 40px; font-size: 14px; font-weight: bold;  background:#FFF; border:1px solid #E8E8E8; border-radius:4px 4px 0 0; float: left;  position: relative; top:10px; left:10px; border-bottom: none;}
    .shop_bd_shdz_title p{float: right;}
    .shop_bd_shdz_title p a{margin:0 8px; color:#555555;}

    .shop_bd_shdz_lists{width:1000px;}
    .shop_bd_shdz_lists ul{width:1000px;}
    .shop_bd_shdz_lists ul li{width:980px; border-radius: 3px; margin:5px 0; padding-left:18px; line-height: 40px; height:40px; border:1px solid #FFE580; background-color:#FFF5CC;}
    .shop_bd_shdz_lists ul li label{color:#626A73; font-weight: bold;}
    .shop_bd_shdz_lists ul li label span{padding:10px;}
    .shop_bd_shdz_lists ul li em{margin:0 4px; color:#626A73;}

    .shop_bd_shdz{width:1000px; margin:10px auto 0;}
    .shop_bd_shdz_new{border:1px solid #ccc; width:998px;}
    .shop_bd_shdz_new div.title{width:990px; padding-left:8px; line-height:35px; height:35px; border-bottom:1px solid #ccc; background-color:#F2F2F2; font-color:#656565; font-weight: bold; font-size:14px;}
    .shdz_new_form{width:980px; padding:9px;}
    .shdz_new_form ul{width:100%;}
    .shdz_new_form ul li{clear:both; width:100%; padding:5px 0; height:40px; line-height: 25px;}
    .shdz_new_form ul li label{float:left;width:100px; text-align: right; padding-right: 10px;}
    .shdz_new_form ul li label span{color:#f00; font-weight: bold; font-size:14px; position: relative; left:-3px; top:2px;}
    </style>

  <script type="text/javascript">
  jQuery(function(){
    jQuery("#new_add_shdz_btn").toggle(function(){
      jQuery("#new_add_shdz_contents").show(500);
    },function(){
      jQuery("#new_add_shdz_contents").hide(500);
    });
  });
  </script>
  </head>
  
  <body>
    <!-- Header -wll-2013/03/24 -->
   <div class="shop_hd">
      <!-- Header TopNav -->
      <div class="shop_hd_topNav">
        <div class="shop_hd_topNav_all">
          <!-- Header TopNav Left -->
          @if(!session('id'))
          <div class="shop_hd_topNav_all_left">
            <p>您好，欢迎来到&nbsp;
              美丽说商城&nbsp;[
              <a href={{url('/login')}}>登录</a>]&nbsp;[
              <a href={{url('/register')}}>注册</a>]</p></div>
          @else
            <div class="shop_hd_topNav_all_left">
            <p><span style="color:red">{{session("username")}}</span>&nbsp;您好，欢迎来到&nbsp;
              美丽说商城&nbsp;[
              <a href={{url('/clear/clear')}}>退出</a>]&nbsp;</p></div>
          @endif
          <!-- Header TopNav Left End -->
          <!-- Header TopNav Right -->
          <div class="shop_hd_topNav_all_right">
            <ul class="topNav_quick_menu">
              <li>
                <div class="topNav_menu">
                  <a href="#" class="topNavHover">我的商城
                    <i></i>
                  </a>
                  <div class="topNav_menu_bd" style="display:none;">
                    <ul>
                      <li>
                        <a title="已买到的商品" target="_top" href="{{url('/order/orderlist')}}">已买到的商品</a></li>
                      <li>
                        <a title="个人主页" target="_top" href="{{url('/basics/basics')}}">个人主页</a></li>
                      <li>
                        <a title="我的好友" target="_top" href="#">我的好友</a></li>
                    </ul>
                  </div>
                </div>
              </li>
              <li>
                <div class="topNav_menu">
                  <a href="#" class="topNavHover">卖家中心
                    <i></i>
                  </a>
                  <div class="topNav_menu_bd" style="display:none;">
                    <ul>
                      <li>
                        <a title="已售出的商品" target="_top" href="#">已售出的商品</a></li>
                      <li>
                        <a title="销售中的商品" target="_top" href="#">销售中的商品</a></li>
                    </ul>
                  </div>
                </div>
              </li>
              <li>
                <div class="topNav_menu">
                  <a href="{{ url('/cart') }}" class="topNavHover">购物车</a>
                  <div class="topNav_menu_bd" style="display:none;">
                    <!-- <ul>
                    <li><a title="已售出的商品" target="_top" href="#">已售出的商品</a></li>
                    <li><a title="销售中的商品" target="_top" href="#">销售中的商品</a></li></ul>
                    -->
                    <p>还没有商品，赶快去挑选！</p>
                  </div>
                </div>
              </li>
              <li>
                <div class="topNav_menu">
                  <a href="#" class="topNavHover">我的收藏
                    <i></i>
                  </a>
                  <div class="topNav_menu_bd" style="display:none;">
                    <ul>
                      <li>
                        <a title="收藏的商品" target="_top" href="{{ url('/collection/index/1') }}">收藏的商品</a></li>
                      <li>
                        <a title="收藏的店铺" target="_top" href="{{ url('/collection/index/2') }}">收藏的店铺</a></li>
                    </ul>
                  </div>
                </div>
              </li>
              <li>
                <div class="topNav_menu">
                  <a href="#">站内消息</a></div>
              </li>
            </ul>
          </div>
          <!-- Header TopNav Right End --></div>
        <div class="clear"></div>
      </div>
      <div class="clear"></div>
      <!-- Header TopNav End -->
      <!-- TopHeader Center -->
      <div class="shop_hd_header">
        <div class="shop_hd_header_logo">
          <h1 class="logo">
            <a href="/">
              <img src="/public/home/images/logo.png" alt="ShopCZ" /></a>
            <span>ShopCZ</span></h1>
        </div>
        <div class="shop_hd_header_search">
          <ul class="shop_hd_header_search_tab">
            <li id="search" class="current">商品</li>
          </ul>
          <div class="clear"></div>
          <div class="search_form">
            <form method="get" action="{{url('/goodslist')}}">
              <div class="search_formstyle">
                <input type="text" class="search_form_text" name="goods_name" placeholder="请输入商品名称!" />
                <input type="submit" class="search_form_sub" name="secrch_submit" value="" title="搜索" /></div>
            </form>
          </div>
          <div class="clear"></div>
          <div class="search_tag">
            <a href="{{url('/goodslist?goods_name=裙子')}}">裙子</a>
            <a href="{{url('/goodslist?goods_name=上衣')}}">上衣</a>
            <a href="{{url('/goodslist?goods_name=连衣裙')}}">连衣裙</a>
            <a href="">化妆品</a>
            <a href="">手提包</a></div>
        </div>

      </div>
      <div class="clear"></div>
      <!-- TopHeader Center End -->
      <!-- Header Menu -->
      <div class="shop_hd_menu">
        <!-- 所有商品菜单 -->
        <div id="shop_hd_menu_all_category" class="shop_hd_menu_all_category"><!-- 首页去掉 id="shop_hd_menu_all_category" 加上clsss shop_hd_menu_hover -->
        <div class="shop_hd_menu_all_category_title"><h2 title="所有商品分类"><a href="javascript:void(0);">所有商品分类</a></h2><i></i></div>
        <div id="shop_hd_menu_all_category_hd" class="shop_hd_menu_all_category_hd">
          <ul class="shop_hd_menu_all_category_hd_menu clearfix">
            <!-- 菜单项 -->
            @foreach($menu as $k=>$v)
            <li id="cat_{{$k+1}}" class="">
              <h3><a href="{{ url('/goodslist?cate='.$v->id) }}" >{{ $v->name }}</a></h3>
              @if($v->sub)
              <div id="cat_1_menu" class="cat_menu clearfix" style="">
                @foreach($v->sub as $kk=>$vv)
                <dl class="clearfix">
                  <dt><a href="{{ url('/goodslist?cate='.$vv->id) }}" >{{ $vv->name }}</a></dt>
                  @if($vv->sub)
                  <dd>
                    @foreach($vv->sub as $kkk=>$vvv)
                    <a href="{{ url('/goodslist?cate='.$vvv->id) }}">{{ $vvv->name }}</a>
                    @endforeach
                  </dd>
                  @endif
                </dl>
                                @endforeach
              </div>
                            @endif
            </li>
            @endforeach
            <!-- 菜单项 End -->
          </ul>
        </div>
      </div>
        <!-- 所有商品菜单 END -->
        <!-- 普通导航菜单 -->
        <ul class="shop_hd_menu_nav">
          <li class="current_link">
            <a href="{{url('/')}}">
              <span>首页</span></a>
          </li>
          <li class="link">
            <a href="">
              <span>团购</span></a>
          </li>
          <li class="link">
            <a href="">
              <span>品牌</span></a>
          </li>
          <li class="link">
            <a href="">
              <span>优惠卷</span></a>
          </li>
          <li class="link">
            <a href="">
              <span>积分中心</span></a>
          </li>
          <li class="link">
            <a href="">
              <span>运动专场</span></a>
          </li>
          <li class="link">
            <a href="">
              <span>微商城</span></a>
          </li>
          <li class="link">
            <a href="{{ url('/community/index') }}">
              <span>社区</span></a>
          </li>
        </ul>
        <!-- 普通导航菜单 End --></div>
      <!-- Header Menu End --></div>
    <div class="clear"></div>
    <!-- 面包屑 注意首页没有 -->
    <div class="shop_hd_breadcrumb">
      <strong>当前位置：</strong>
      <span>
        <a href="{{url('/')}}">首页</a>&nbsp;›&nbsp;
        <a href="{{url('/cart')}}">我的购物车</a>&nbsp;›&nbsp;
        确认订单

        </span>
    </div>
    <div class="clear"></div>
    <!-- 面包屑 End -->
    <!-- Header End -->
    <!-- 购物车 Body -->
    <div class="shop_gwc_bd clearfix">
      <!-- 在具体实现的时候，根据情况选择其中一种情况 -->
      <!-- 购物车为空 -->
      
      <!-- 购物车为空 end-->
      <!-- 购物车有商品 -->
      <div class="shop_gwc_bd_contents clearfix">
        <!-- 购物流程导航 -->
        <div class="shop_gwc_bd_contents_lc clearfix">
          
         <ul>
          <li class="step_a">确认购物清单</li>
          <li class="step_b hover_b">确认收货人资料及送货方式</li>
          <li class="step_c">购买完成</li>
        </ul>
        </div>
        <!-- 购物流程导航 End -->
        <form action="/order/insert" method="post">
      <div class="shop_bd_shdz_title">
        <h3>收货人地址</h3>
        <p><a href="javasrcipt:void(0);" id="new_add_shdz_btn">添加地址</a><a href="{{url('/address/addrlist')}}">管理地址</a></p>
      </div>
      <div class="clear"></div>
      <!-- 中部的订单地址 -->
      <div class="shop_bd_shdz clearfix">
        <div class="shop_bd_shdz_lists clearfix">
          <ul>
          @foreach($address as $k=>$v)
            <li>
              <label>寄送至：<span><input type="radio" name="addr_id" value="{{$v->id}}" <?php if($v->astatus==1) echo 'checked'; ?>></span></label><em class="sheix">{{$v->sheng}},{{$v->shi}},{{$v->xian}}</em><em>{{$v->info}}</em><em>{{$v->aname}}(收)</em><em>联系方式:</em><em>{{$v->phone}}</em>
            </li>
          @endforeach
          </ul>
        </div>
        <!-- 新增收货地址 -->
        <div id="new_add_shdz_contents" style="display:none;" class="shop_bd_shdz_new clearfix">
          <div class="title">新增收货地址</div>
          <div class="shdz_new_form">
            
              <ul>
                <li><label for=""><span>*</span>收货人姓名：</label><input type="text" id="aname" class="name" style="width:500px;height:30px" readmin="请输入姓名"></li>
                <li><label for=""><span>*</span>所在地址：</label>
                  
                
                <!--导入插件-->
                <script type="text/javascript" src="/public/home/location/jquery.js"></script>
                <script type="text/javascript" src="/public/home/location/area.js"></script>
                <script type="text/javascript" src="/public/home/location/location.js"></script>

                  <!--层级联动选择框-->
                <select id="loc_province" class="" name="sheng" style="width:80px;height:30px;"></select>
                <select id="loc_city" class="" name="shi" style="width:100px;height:30px;"></select>
                <select id="loc_town" class="" name="xian" style="width:120px;height:30px;"></select>
                </li>
                <li><label for=""><span>*</span>详细地址：</label><input id="info" type="text" class="xiangxi" style="width:500px;height:30px" readmin="请输入详细地址"></li>
                <li><label for=""><span></span>邮政编码：</label><input id="posid" type="text" class="youbian" style="width:500px;height:30px" readmin="请输入邮政编码"></li>
                <li><label for=""><span></span>手机号：</label><input id="phone" type="text" class="shouji" style="width:500px;height:30px" readmin="请输入手机号码"></li>
                <li><label for="">&nbsp;</label><input id="sub" type="button" value="添加"></li>
              </ul>
            
            
         </div>
        </div>
        <!-- 新增收货地址 End -->
      </div>
      <div class="clear"></div>
      <div class="shop_bd_shdz_title">
        <h3>确认购物清单</h3>
      </div>
        <!-- 购物车列表 -->
      
        <table>
          <thead>
            <tr>
              <th colspan="2">
                <span>商品</span></th>
              <th>
                <span>单价(元)</span></th>
              <th>
                <span>数量</span></th>
              <th>
                <span>小计</span></th>
              
            </tr>
          </thead>
          <tbody>
          @foreach($goods as $k=>$v)
            <tr class="price">
              <td class="gwc_list_pic">
                <a href="">
                  <img src="{{$v['goods_pic']}}" width="100px" height="150px"/></a>
              </td>
              <td class="gwc_list_title">
                <a href="">{{$v['goods_name']}}</a><br /><br />
                <span style="color:#f36;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;颜色:{{$v['color']}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;尺寸:{{$v['size']}}</span>
              </td>
                <td class="gwc_list_danjia">
                <span>￥
                  <strong id="danjia_001" class="danjia">{{$v['goods_price']}}</strong></span>
              </td>
              <td class="gwc_list_shuliang">
                <span>
                  <input type="text" value="{{$v['goods_num']}}"  id="goods_001" class="good_nums" />
              </td>
              <td class="gwc_list_xiaoji">
                <span>￥
                  <strong id="xiaoji_001"  class="good_xiaojis">{{$v['goods_price'] * $v['goods_num']}}</strong></span>
                 
              </td>
             <input type="hidden" value="{{$k}}"  name="id" />
             <!-- <input type="hidden" value="{{$k}}"  name="gid[]" /> -->
             <input type="hidden" value="{{$v['goods_id']}}" name="goods_id[]" />
             <input type="hidden" name="goods_num[]" value="{{$v['goods_num']}}" />
             <input type="hidden" name="goods_money[]" value="{{$v['goods_price'] * $v['goods_num']}}" />
             <input type="hidden" name="color[]" value="{{$v['color']}}" />
             <input type="hidden" name="size[]" value="{{$v['size']}}" />
             {{csrf_field()}}
              
            </tr>
          @endforeach 
        
          </tbody>
          <tfoot>
            <tr>
              <td colspan="6">
                <div class="gwc_foot_zongjia">商品总价(不含运费)
                  <span>￥
                    <strong id="good_zongjia">{{$tsum}}</strong></span>
                </div>
                <div class="clear"></div>
                <div class="gwc_foot_links">
                  <a href="{{url('/goodslist')}}" class="go">继续购物</a>
                  <!-- <a href="" class="op">确认收货地址</a> -->
                  <input type="submit" style="background: #FE8502;width:100px;height: 40px;border-radius:10px;color:white" value="提交订单" /></div>
              </td>
            </tr>
          </tfoot>
        </table>
      </form>
        <!-- 购物车列表 End --></div>
      <!-- 购物车有商品 end --></div>
    <!-- 购物车 Body End -->
    <!-- Footer - wll - 2013/3/24 -->
    <div class="clear"></div>
    <div class="shop_footer">
      <div class="shop_footer_link">
        <p>
          <a href="">首页</a>|
          <a href="">招聘英才</a>|
          <a href="">广告合作</a>|
          <a href="">关于ShopCZ</a>|
          <a href="">关于我们</a></p>
      </div>
      <div class="shop_footer_copy">
        <p>Copyright 2004-2013 itcast Inc.,All rights reserved.</p>
      </div>
    </div>
    <script type="text/javascript">
      $('#sub').click(function(){
         var aname = $('#aname').val();
        var phone = $('#phone').val();
        var sheng = $('#loc_province').val();
        var shi = $('#loc_city').val();
        var xian = $('#loc_town').val();
        var info = $('#info').val();
        var posid = $('#posid').val();
        
          // alert(aneme);
          $.get('/address/insert',{aname:aname,phone:phone,sheng:sheng,shi:shi,xian:xian,info:info,posid:posid},function(data){
            if(data == 1){
              // console.log(data);
              // alert('111');
              location.reload();
            }else{
              alert('添加失败');
            }
          })
      })




    </script>
    <script type="text/javascript">
      $(document).ready(function() {
        showLocation();

        $('.sheix').each(function(){
          var str = $(this).html();
          var info = getInfo(str);
          $(this).html(info);
        });

        //定义获取城市信息方法
        function getInfo(str){
          //console.log(str);
          //拆分字符串
          var arr = str.split(',');
          // console.log(arr);  
          var ls  = new Location;
          var l = ls.items;
          // console.log(l['0,1,2']['5']);
          var sheng = l['0'][arr[0]];
          var shi = l['0,'+arr[0]][arr[1]];
          var xian = l['0,'+arr[0]+','+arr[1]][arr[2]];
          return sheng+shi+xian;
        }

        //点击选中默认地址
        $('#addresses .item').each(function(){
          $(this).click(function(){
            //
            $('#addresses .item').removeClass('aa');  
            $(this).addClass('aa');
            //获取当前点击的地址id
            var id  = $(this).attr('aid');  
            $('input[name=address_id]').val(id);
          })
        })        
      });



  </script>

    <!-- Footer End --></body>

</html>